{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c1e234c4",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Author: jiang\n",
    "# week05: 数据结构之列表\n",
    "\n",
    "# names = \"zhichao,youge,xiaoming,xiaohong\"\n",
    "# print(names[1])\n",
    "users_list = [\"zhichao\",\"youge\",\"xiaoming\"]\n",
    "password_list = [123456,789654,273843]\n",
    "age_list = [23,28,18]\n",
    "# ...\n",
    "# 列表的嵌套\n",
    "info_list = [[\"zhichao\",123456,23],[\"youge\",123456,28]]\n",
    "\n",
    "print(users_list[0])\n",
    "print(password_list[0])\n",
    "print(age_list[0])\n",
    "print(info_list[-1])\n",
    "\n",
    "# -3,-2,-1,0,1,2,\n",
    "names = [\"Mike\",\"Mary\",\"Jan\",\"Jack\"]\n",
    "# 知识点 slices(切片) 数值是指 values在list中的位置\n",
    "\n",
    "# 1. 正向取值\n",
    "# list 取值 “:”右边的值取不到 例如[1:3] 3 这个位置取不到\n",
    "print(names[1:3])\n",
    "print(names[0:2])\n",
    "# 如果 左侧的值是0 即从0开始取值，0可以省略不写\n",
    "print(names[:2])\n",
    "\n",
    "# 2. 反向取值\n",
    "# list 取值 “:”右边的值取不到 例如[-3:-1] -1 这个位置取不到\n",
    "# 注意： 取到最后一个值，不能写 0 省略不写即可\n",
    "print(names[-3:1])\n",
    "\n",
    "num = [1,2,3,4,5,6,7,8,9]\n",
    "# 对比 range\n",
    "print(list(range(10)))\n",
    "print(num[:6:2])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
